package com.sskj.tibi.presenter;

import com.lzy.okgo.model.Response;
import com.sskj.common.base.HttpData;
import com.sskj.lib.http.JsonCallBack;
import com.sskj.tibi.bean.RateBean;
import com.sskj.tibi.http.HttpConfig;
import com.sskj.tibi.ui.fragment.QuickBuyFragment;


public class QuickBuyFragmentPresenter extends BasePresenter<QuickBuyFragment> {


    /**
     * 用户在线充值
     *
     * @param money 充值的USDT金额 200-200000


     * @return
     */
    public void apiRechargeOnlinerecharge(String money) {
        httpService.apiRechargeOnlinerecharge(money).execute(new JsonCallBack<HttpData<String>>(this) {
            @Override
            public void onSuccess(Response<HttpData<String>> response) {
                HttpData<String> httpData = response.body();
                if (httpData.getStatus() == HttpConfig.OK) {
                    mView.onLineRecharge(httpData.getData());
                }
            }
        });
    }
        

    /**
     * 获取汇率
     *

     * @return
     */
    public void apiGetrate() {
        httpService.apiGetrate().execute(new JsonCallBack<HttpData<RateBean>>() {
            @Override
            public void onSuccess(Response<HttpData<RateBean>> response) {
                HttpData<RateBean> httpData = response.body();
                if (httpData.getStatus() == HttpConfig.OK) {
                    mView.updateUI(httpData.getData());
                }
            }
        });
    }
        
}